﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;
using System.Net;

namespace Planetwork.App_Code
{
    public class SendEmail
    {
        public static string  EmailSetting(string subject, string body, string toEmail)
        {
            SmtpClient smtpclient = new SmtpClient();
            smtpclient.Port = 25;
            smtpclient.Host = "smtp.163.com";
            smtpclient.Credentials= new NetworkCredential("xqianxin", "ywshmily0902");

            MailMessage mailMessage = new MailMessage(
                "xqianxin@163.com",
                toEmail,
                subject,
                body
                );

           try
            {
                smtpclient.Send(mailMessage);
                return "S";
            }
            catch(Exception ex)
            {
                return "Send failed: " + ex.ToString();
            }
        }
    }
}